package com.wbt.spring.event;

import com.wbt.spring.event.task.Task;
import com.wbt.spring.event.task.TaskFinishStatus;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;

@ComponentScan("com.wbt.spring.event.**")
public class ContextApplication {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ContextApplication.class);

        Task task = new Task("dd", TaskFinishStatus.FAIL);
        TaskFinishEvent taskFinishEvent = new TaskFinishEvent(task);
        EventPublisher bean = context.getBean(EventPublisher.class);
        bean.publishEvent(taskFinishEvent);
    }
}
